package com.bsoft.gol.hcs.visitrecord.dao;

import ctd.persistence.annotation.DAOMethod;
import ctd.persistence.annotation.DAOParam;
import ctd.persistence.support.hibernate.HibernateSupportDelegateDAO;
import com.bsoft.gol.hcs.visitrecord.entity.DataSyncScheduledInfo;

import java.util.List;

/**
 * @Author: lanyu
 * @Description: his数据同步任务执行记录DAO
 * @Date: create in 2022/5/30 11:10
 */
public abstract class DataSyncScheduledInfoDAO extends HibernateSupportDelegateDAO<DataSyncScheduledInfo> {

    /**
     * 更新执行状态-完成
     */
    @DAOMethod(sql = "update DataSyncScheduledInfo set status ='1' where time=:time and type=:type")
    public abstract void updateDataSyncScheduledInfo(@DAOParam("time") String time, @DAOParam("type") String type);

    /**
     * 根据时间和类型获取记录信息
     *
     * @param time
     * @param type
     * @return
     */
    @DAOMethod(sql = " from DataSyncScheduledInfo where time=:time and org_id =:orgId and type=:type ")
    public abstract DataSyncScheduledInfo getDataSyncScheduledInfo(@DAOParam("time") String time, @DAOParam("orgId") String orgId, @DAOParam("type") Integer type);

    /**
     * 根据时间和类型获取记录信息列表
     *
     * @param time
     * @param type
     * @return
     */
    @DAOMethod(sql = "from DataSyncScheduledInfo where time < :time and type=:type and status != '1' ")
    public abstract List<DataSyncScheduledInfo> queryDataSyncScheduledInfoList(@DAOParam("time") String time, @DAOParam("type") Integer type);
}
